home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1351 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.5 KB  |  84 lines

  1. Path: hai.hiMolde.no!runee
  2. From: runee@hai.hiMolde.no (Rune Espeseth)
  3. Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
  4. Subject: Re: How do I define my integers?
  5. Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
  6. Date: 15 Jan 1996 23:56:36 GMT
  7. Organization: Molde College, Department of Computer Science
  8. Message-ID: <4depjk$mvi@ulke.hiMolde.no>
  9. References: <4d73ug$25v@vixen.cso.uiuc.edu>
  10. NNTP-Posting-Host: hai.himolde.no
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. howard daniel joseph (djhoward@ux5.cso.uiuc.edu) wrote:
  14. :     Okay. I'm writing a program under GCC on my Amiga.
  15.  
  16. :     But I'm confused to hell over integer limits.
  17.  
  18. :     My book talks about 2 bit and 4 bit integers ... and four bit 
  19.                             ^^^^^^^^^^^^^^^^^
  20. That's 2 byte and 4 byte integers (word and longword, respectively.)
  21.  
  22. : integers like what it describers long integers to be. Of course there's 
  23. : unsigned integers and the like too.
  24.  
  25. : How do I declare signed versus unsigned integers?
  26.  
  27. #include    <exec/types.h>
  28.  
  29. unsigned long my32bitnumber; // Longword 0-4millionsomething (2^32)
  30. signed word my16bit_s_number;  // WORD -32768 - 32767 ....
  31.  
  32. or with the include mentioned above:
  33.  
  34. ULONG my32bitnumber;
  35. WORD my16bit_s_number;
  36.  
  37. : How do I know how many bits my integers are using?
  38.  
  39. BYTE=8 bit , WORD=16 bit and LONG =32bit.
  40.  
  41. : How do I declare signed and unsigned long integers?
  42.  
  43. See above... :-)
  44.  
  45. : What's with these "doubles" the book mysteriously alludes to?
  46.  
  47. double long my64bitint; (..or was it long double... can't remember...)
  48.  
  49. : What *am* I creating when I type;
  50.  
  51. : int somevalue;
  52. Depends... Some compilers let you set the int size.
  53. Guess it's signed... 
  54. : (ie Is it signed/unsigned? How many bits?)
  55.  
  56. : I know many of the answers here, but if I could get them all from one 
  57. : source I'd feel a lot better.
  58.  
  59. : I need two sorts of values for my project;
  60.  
  61. : An integer (unsigned) that can handle, 6, though ideally 9 places (Just 
  62. : under 250000000 would be the maximum forseen possible value here.)
  63.  
  64. Sounds like you have to go for double....
  65.  
  66. : An integer that can handle a much bigger number ... 12 places at least for 
  67. : now.
  68.  
  69. : Can I perform simple maths (addition, division) between integers of 
  70. : different types? I'd assume so, right?
  71.  
  72. Yes, but you have to cast it to the right type first...
  73.  
  74. Good luck!
  75.  
  76. --
  77. Regards,
  78. Rune Espeseth
  79.  
  80. -------------
  81. CyberStorm060/50Mhz, CyberVision64/4Mb
  82. Computer Information Science Student at Molde College, Norway
  83. Email: lakris@ask.himolde.no | Rune.Espeseth@himolde.no
  84.